-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PKG -- [fcl] Default to localStorage #1782
Conversation
🦋 Changeset detectedLatest commit: f114a72 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
const getSessionStorage = () => { | ||
try { | ||
const SESSION_STORAGE = { | ||
can: !isServerSide(), | ||
get: async key => JSON.parse(sessionStorage.getItem(key)), | ||
put: async (key, value) => sessionStorage.setItem(key, JSON.stringify(value)), | ||
} | ||
return SESSION_STORAGE | ||
} catch (error) { | ||
return null | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I scrapped the factory function here just because it feels simpler for the user to say fcl.storage.default=LOCAL_STORAGE
than fcl.storage.default=getLocalStorage()
for users. It seems like a bit of an unnecessary abstraction since the object returned is always the same & there's no errors that can occur in the try-catch block anyways.
Happy to reconsider if there's any objections to this however.
This reverts commit 3d037e8.
closes #1776